<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.js"></script>
    <script src="https://cdn.staticfile.org/vue-router/3.5.3/vue-router.js"></script>
  </head>
  <body>
    <div id="app">
      <h1>网易云音乐</h1>
      <ul>
        <router-link to="/">推荐音乐</router-link>
        <router-link to="/hot">热门</router-link>
        <router-link to="/search">搜索</router-link>
      </ul>
      <hr />
      <router-view></router-view>
    </div>
    <script>
      //  / /hot /serach
      const Home = { template: "<div>Home</div>" };
      const Hot = { template: "<div>Hot</div>" };
      const Search = { template: "<div>Search</div>" };

      new Vue({
        el: "#app",
        router: new VueRouter({
          routes: [
            {
              path: "/",
              component: Home,
            },
            {
              path: "/hot",
              component: Hot,
            },
            {
              path: "/search",
              component: Search,
            },
          ],
        }),
      });
    </script>
  </body>
</html>
